// --------------------------------------------------------------------------------------------
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// 
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
// 
// <remarks>
// Generated by IDLImporter from file nsILoadContext.idl
// 
// You should use these interfaces when you access the COM objects defined in the mentioned
// IDL/IDH file.
// </remarks>
// --------------------------------------------------------------------------------------------
namespace Gecko
{
	using System;
	using System.Runtime.InteropServices;
	using System.Runtime.InteropServices.ComTypes;
	using System.Runtime.CompilerServices;
	
	
	/// <summary>
    /// An nsILoadContext represents the context of a load.  This interface
    /// can be queried for various information about where the load is
    /// happening.
    /// </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("c71ef717-8fb9-425e-98ef-aef5894890f8")]
	public interface nsILoadContext
	{
		
		/// <summary>
        /// associatedWindow is the window with which the load is associated, if any.
        /// Note that the load may be triggered by a document which is different from
        /// the document in associatedWindow, and in fact the source of the load need
        /// not be same-origin with the document in associatedWindow.  This attribute
        /// may be null if there is no associated window.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIDOMWindow GetAssociatedWindowAttribute();
		
		/// <summary>
        /// topWindow is the top window which is of same type as associatedWindow.
        /// This is equivalent to associatedWindow.top, but is provided here as a
        /// convenience.  All the same caveats as associatedWindow of apply, of
        /// course.  This attribute may be null if there is no associated window.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIDOMWindow GetTopWindowAttribute();
		
		/// <summary>
        /// topFrameElement is the <iframe>, <frame>, or <browser> element which
        /// contains the topWindow with which the load is associated.
        ///
        /// Note that we may have a topFrameElement even when we don't have an
        /// associatedWindow, if the topFrameElement's content lives out of process.
        /// topFrameElement is available in single-process and multiprocess contexts.
        /// Note that topFrameElement may be in chrome even when the nsILoadContext is
        /// associated with content.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIDOMElement GetTopFrameElementAttribute();
		
		/// <summary>
        /// If this LoadContext corresponds to a nested remote iframe, we don't have
        /// access to the topFrameElement.  Instead, we must use this id to send
        /// messages. A return value of 0 signifies that this load context is not for
        /// a nested frame.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		ulong GetNestedFrameIdAttribute();
		
		/// <summary>
        /// Check whether the load is happening in a particular type of application.
        ///
        /// @param an application type.  For now, the constants to be passed here are
        /// the nsIDocShell APP_TYPE_* constants.
        ///
        /// @return whether there is some ancestor of the associatedWindow that is of
        /// the given app type.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool IsAppOfType(uint appType);
		
		/// <summary>
        /// True if the load context is content (as opposed to chrome).  This is
        /// determined based on the type of window the load is performed in, NOT based
        /// on any URIs that might be around.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetIsContentAttribute();
		
		/// <summary>
        /// Attribute that determines if private browsing should be used.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetUsePrivateBrowsingAttribute();
		
		/// <summary>
        /// Attribute that determines if private browsing should be used.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetUsePrivateBrowsingAttribute([MarshalAs(UnmanagedType.U1)] bool aUsePrivateBrowsing);
		
		/// <summary>
        /// Attribute that determines if remote (out-of-process) tabs should be used.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetUseRemoteTabsAttribute();
		
		/// <summary>
        /// Set the private browsing state of the load context, meant to be used internally.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetPrivateBrowsing([MarshalAs(UnmanagedType.U1)] bool aInPrivateBrowsing);
		
		/// <summary>
        /// Set the remote tabs state of the load context, meant to be used internally.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetRemoteTabs([MarshalAs(UnmanagedType.U1)] bool aUseRemoteTabs);
		
		/// <summary>
        /// Returns true iff the load is occurring inside a browser element.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetIsInBrowserElementAttribute();
		
		/// <summary>
        /// Returns the app id of the app the load is occurring is in. Returns
        /// nsIScriptSecurityManager::NO_APP_ID if the load is not part of an app.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		uint GetAppIdAttribute();
		
		/// <summary>
        /// A dictionary of the non-default origin attributes associated with this
        /// nsILoadContext.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		Gecko.JsVal GetOriginAttributesAttribute();
	}
}
